package com.ws.client.other;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

public class FolderInfo {
    private int index;
    private String folderName;
    private long creationTime;

    public FolderInfo(int index, String folderName, long creationTime) {
        this.index = index;
        this.folderName = folderName;
        this.creationTime = creationTime;
    }

    public int getIndex() {
        return index;
    }

    public String getFolderName() {
        return folderName;
    }

    public long getCreationTime() {
        return creationTime;
    }

    public static List<FolderInfo> getSecondLevelFolders(String directoryPath) {
        List<FolderInfo> folderList = new ArrayList<>();

        File directory = new File(directoryPath);
        if (directory.isDirectory()) {
            File[] folders = directory.listFiles();

            if (folders != null) {
                int index = 1;
                for (File folder : folders) {
                    if (folder.isDirectory()) {
                        if (folder.isDirectory()) {
                            folderList.add(new FolderInfo(index, folder.getName(), folder.lastModified()));
                        }
                        index++;
                    }
                }
            }
        }

        return folderList;
    }
}